<div id="goodslist" class="tableform">
	<div class="goodslistcontent">
		<div class="m5">
			<{button label=$___b2c="添加LOGO列表"|t:'b2c' id="add_more" app="desktop" icon="btn_add.gif"}>
		</div>
		<table  width="100%" cellpadding="0" cellspacing="0" id="more_link">
			<{foreach from=$setting.pic item=data key=key}>
			<tr>
				<th><{t app="b2c"}>商品图片:<{/t}></th>
				<td>
					<input type=hidden name=pic[<{$data.id}>][id] value="<{$data.id}>">
                    <input name='pic[<{$data.id}>][link]'  value="<{$data.link}>">
					<input type=button value=上传图片 class="uploadbtn" onclick="addPic(this);">
				</td>
				<th><{t app="b2c"}>链接地址:<{/t}></th>
                <td>
                    <input name="pic[<{$data.id}>][linktarget]" value="<{$data.linktarget}>">
                </td>
				<th><{t app="b2c"}>描述<{/t}></th>
				<td><input name="pic[<{$data.id}>][linkinfo]" value="<{$data.linkinfo}>"></td>
				<td><span onclick="$(this).getParent('tr').destroy()"><{img src="bundle/delecate.gif" style="cursor:pointer;" alt=$___b2c="删除"|t:'b2c' title=$___b2c="删除"|t:'b2c' app="desktop"}></span></td>
            </tr>
			<{/foreach}>
        </table>
	</div>
</div>
<script>
function addPic(eleid){
	var url='index.php?app=desktop&act=alertpages&goto='+encodeURIComponent("index.php?app=image&ctl=admin_manage&act=image_broswer&type=big");
	Ex_Loader('modedialog',function(){
		return new imgDialog(url,{onCallback:function(image_id,image_src){
				$(eleid).getPrevious('input').value=image_src;
		}})	;
	});
}

function addMoreLink(){
	var i=new Date().getTime();
	var linkItem = new Element('tr',{
		'class':'more-item',
		'html':'<th><{t app="b2c"}>商品图片:<{/t}></th><td><input type="hidden" name="pic['+i+'][id]" value="'+i+'"/><input type="text" name="pic['+i+'][link]"/><input type=button value=上传图片 class="uploadbtn" onclick="addPic(this);"></td><th><{t app="b2c"}>链接地址:<{/t}></th><td><input name="pic['+i+'][linktarget]" value="" type="text"/></td><th><{t app="b2c"}>描述<{/t}></th><td><input type="text" value="" name="pic['+i+'][linkinfo]"/></td><td><span onclick="$(this).getParent(\'tr\').destroy()"><{img src="bundle/delecate.gif" style="cursor:pointer;" alt=$___b2c="删除"|t:'b2c' title=$___b2c="删除"|t:'b2c' app="desktop"}></span></td>'
	});
	linkItem.inject($('more_link'));
}
$('add_more').addEvent('click',function(){
	addMoreLink();
});
</script>